<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="css/conmmon.css">
 
    <script src="js/jquery.min.js"></script>
</head>
<style>
    .personal{
      height: 100%;
      width: 800px;
      margin-left: 0 auto;
      background-color: rgba(255, 255, 255, 0.8);
      border-radius: 10px;
      padding: 30px;
      margin: 0 auto;
    }
  .one1{
    margin-top: 30px;
    font-weight: bolder;
    text-align: center;
  }
  .one{
    font-weight: bolder;
    width: 100%;
    display: inline-block;
    font-size: 20px;
  }
  .one1 input{
    margin-top: 10px;
  }
  button{
    margin-top: 20px;
    font-size: 30px;

  }



</style>




<body>

    <div class="personal" id="personal">
        <div class="one1">
            <span class="one" >原始密码</span>  
            <input type="text" id="oldpwd" >
        </div> 
        <div class="one1">
          <span class="one" >新密码</span>  
          <input type="text" id="newpwd" >
        </div> 
        <div class="one1">
            <button onclick="sub()">保存</button>
        </div>   
        
    </div>


    <script>

        

        function sub(){
            //获取用户输入的信息
           var oldpwd = jQuery("#oldpwd").val();
           var newpwd = jQuery("#newpwd").val();
           
           jQuery.ajax({
                url:"/personal/updatepwd",
                type:"POST",
                data:{"oldpwd":oldpwd,"newpwd":newpwd},
                success:function(result){
                    if(result!=null && result.code==200 && result.data!=null){
                        alert("修改成功");
                        location.href = "/login.html";
                    }else{
                        alert(result.msg);
                    }
                }
            });
        
    
            
        }
        




    </script>
 



</body>

</html>
